#Evernote Programming Challenge--top four
def solve(l):
  l = sorted(l)
  i = 1
  while i <= 4:
	print l[n-i]
	i = i + 1

# Getting Inputs
n = input()
l = []
for line in range(n):
	l.append(input())

solve(l)